From: Ron Smits (ron@draconia.hacktic.nl) Subject: Re: Creating root disk Newsgroups: comp.os.linux.admin View this article only Date: 1994-03-23 00:35:41 PST Laurent Chavey (chavey@ori.cis.udel.edu) wrote: : How does one create a root floppy from linux. : thank you. -- Included is a BOOTFLOP-HOWTO that I wrote a few months ago Ron Smits ron@draconia.hacktic.nl Ron.Smits@Netherlands.NCR.COM /*-( My opinions are my opinions, My boss's opinions are his opinions )-*/ /*-( They might not be the same -*/ The Making of a bootable floppy February 1, 1994 Ron Smits (ron@draconia.hacktic.nl) Every now and then the question arises on the net on how to make a bootable disk. There are several reasons for people to make a bootable disk. They want to have an emergency disk, they want to roll their on distribution set or they just want to know how it is done. This document will be an attempt to describe all the necessary steps that will lead to a bootable floppy. At the end of the document you will know how to make bootable floppy that will load itself into a ramdisk and how to make one that's just bootable. It's basically the same. Any comments on how to improve this document, please let me know on the above mail address. All comments and suggestions are welcome. ---------------------------------------------------------------------- Right let's get on with it. I will describe the way I usually follow when making a bootable disk. (I do this so every now and then to keep kernels uptotdate and to pass among my friends and collegues to let them experience the 'Linux' feel). 1. The kernel Create a kernel with root device set to /dev/fd0. You can accomplish this in two ways: 1. Edit Makefile in /usr/src/linux and set the variable `ROOT_DEV' to /dev/fd0 or keep it empty. If you keep it empty, the default of FLOPPY will be used by build. Personnaly I like to fill it in, keeps you from guessing and remembering what the default was. 2. take an exsisting kernel and patch it with `rdev' like this # rdev -r zImage /dev/fd0 this will patch the kernel named zImage to use the floppy as rootdevice. ---- 2. the files Create a subdirectory somewhere on your system as root. Call it for example /tmp/bootflop. In this directory create the following directories: bin etc etc/lilo lib dev You must populate these directories with some esential files in order to have a working system: bin: cp, df, fsck, fsck.ext2, fsck.minix, ls, rm, sh, vi, mount All these commands, except vi, can --normally-- be found in /bin. vi is usually in /usr/bin. etc: zImage, fstab Fstab is needed for df to work properly, plus you can populate it to have your harddisks mounted on several mnt mountpoints. zImage is the kernel you made in step 1. etc/lilo: any_d.b, boot.b, chain.b, floppy, disktab, lilo, map, mkck, os2_d.b. These files are needed to make the floppy bootable.(We'll come back to one of them later). The file floppy is the lilo configuration file see point 3. lib: libc.so.4 This is the shared library. The other commands need it! Forget it and be amazed when you start from the disk (come on try it :-)) ---- 3. Lilo configuration I always use Lilo to make floppies (and my harddisk) bootable. Here is a copy of the config file I use for floppies, it's named floppy: # # lilo configuration for floppy boot install = /mnt/etc/lilo/boot.b map = /mnt/etc/lilo/map backup = /mnt/etc/lilo/junk compact vga = normal root = /dev/fd0 boot = /dev/fd0 image = /mnt/etc/zImage label = zLinux As you can see, I presume that the floppy is mounted as /mnt when we are making it. it is _*VERY*_ important that the keywords `install' and `map' point to files on the floppy, so in the /mnt/etc/lilo directory. Otherwise the machine will not boot. The backup may point to something else. ---- 4. The floppy Be smart, use a new one! format it: # fdformat /dev/fd0H1440 Make a filesystem on it: # mkfs -t minix /dev/fd0 1440 mount it: # mount -t minix /dev/fd0 /mnt The reason I use a minix filesystem is twofold, first of all, the minix filesystem has less overhead than the more advanced filesystems like extfs and ext2fs. And secondly, the kernel demands a minix filesystem, if you want to copy it to a ramdisk Now copy the tree structure that we made to it: # cd /tmp/bootflop # find . -print | cpio -pvdum /mnt After having populated these directories, go to /mnt/dev and make the device nodes: # cd /mnt/dev # /dev/MAKEDEV generic (Note: I know MAKEDEV is somewhere in a package, but I haven't the faintest idea where. If you need it and can't find it, drop me a line, I'll mail it to you) ---- 5. Making it bootable (finally) We now have a filesytem with the bare minimum on it to make it run as a standalone system. with the tools we placed on it, we can even do some repairing, so the last thing to do is to make it bootable. If you made a lilo configuration file as described in point 3, you can do the following: # cd /mnt/etc/lilo # ./lilo -v -C config You should expect the following as output from lilo: LILO version 0.10 Written 1992,1993 by Werner Almesberger Reading boot sector from /dev/fd0 Merging with /etc/lilo/boot.b Boot image: /mnt/etc/zImage Added zLinux /etc/lilo/junk exists - no backup copy made. Writing boot sector. That's it! you've made a bootable floppy, unmount it and try it out! ---- 6. bootable floppy with a ramdisk. The last thing I want to explain is how to create a ramdisk. The purpose of having a ramdisk is to have your floppy drive free to be able to mount another floppy with even more tools and rescue material on it. (I personally never do it, but have a bootflop with ramdisk any because it's faster then the floppydrive). Actually it's extremely easy and can be done with a one line modification. The kernel provides all the hooks needed. Add the following line to /mnt/etc/lilo/floppy ramdisk = 1440 perform the actions in point 5 again and presto, You have a bootable floppy that copies itself into a ramdisk, leaving your floppydrive free for other more important stuff. ---- 7. the End? The steps described above have been extensively tested by over a longer periode of time. It has proven it's worth! And it made me paranoide, I always make sure that I have at least 2 of them. Murphy lurks in the corner!. This HOWTO is far from perfect, so all remarks and suggestions are welcome. If the interest is ther. I will keep maintaining it. february 4, 1994 Ron Smits ron@draconia.hacktic.nl